<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ page contentType="text/html; charset=utf-8" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>商家管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="/css/bus-style.css">
    <style>
        tr th{text-align: center!important;}
        tr td{text-align: center!important;}
    </style>
</head>
<body>
<div class="layui-container">
    <div class="layui-card">
        <div class="layui-card-body" style="padding: 15px;">
            <table class="layui-table">
                <thead>
                <tr>
                    <th>商品名称</th>
                    <th>商品规格名称</th>
                </tr>
                </thead>
                <tbody>
                <c:if test="${detailList != null }">
                    <c:forEach items="${detailList}" var="l">
                        <tr>
                            <c:set var="str" value="${fn:replace(l.name,'|', '<br>')}" />
                            <td width="30%">${str}</td>
                                <%--<td width="30%">${l.name}</td>--%>
                            <td width="30%">${l.value}</td>
                        </tr>
                    </c:forEach>
                </c:if>

                <c:if test="${detailList == null }">
                        <tr>
                            <td width="30%">自营商品</td>
                            <td width="30%">物流提鸡</td>
                        </tr>
                </c:if>

                </tbody>
            </table>
        </div>
        <div class="layui-card-body" style="padding: 15px;">
            <form class="layui-form" id="orderSendForm">
                <input type="hidden" id="orderId" name="orderId" value="${orderId}">
                <input type="hidden" name="id" value="${expDetailId}">
                <input type="hidden" name="expName" value="">
                <div class="layui-form-item">
                    <label class="layui-form-label"><span class="red">*&nbsp;</span>发货方式</label>
                    <div class="layui-input-block">
                        <select id="receivedType" name="receivedType" lay-filter="received">
                            <option value="">请选择</option>
                            <c:forEach items="${receivedTypeList}" var="r">
                                <option value="${r.id}">${r.name}</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>
                <br>
                <div id="expMsg">
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="red">*&nbsp;</span>物流公司</label>
                        <div class="layui-input-block">
                            <select id="expCode" name="expCode" lay-filter="expCode">
                                <option value="">请选择</option>
                                <c:forEach items="${expList}" var="e">
                                    <option value="${e.expCom}">${e.expName}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                    <br>
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="red">*&nbsp;</span>快递单号</label>
                        <div class="layui-input-block">
                            <input type="text" name="expNo" autocomplete="off"
                                   class="layui-input">
                        </div>
                    </div>
                </div>
            </form>
            <div class="layui-form-item layui-layout-admin">
                <div class="layui-input-block">
                    <div class="layui-footer" style="left: 0;">
                        <button class="layui-btn"
                                onclick="FormSubmit('#orderSendForm','/order/handleSendGood')">发货
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="/layuiadmin/layui/layui.js"></script>
<script type="text/javascript" src="/js/jquery/jquery.min.js"></script>
<script type="text/javascript" src="/js/jquery.form.js"></script>
<script type="text/javascript" src="/js/common.js"></script>
<script>
    layui.config({
        //静态资源所在路径
        base: '/layuiadmin/'
    }).extend({
        //主入口模块
        index: 'lib/index'
    }).use(['index', 'form'], function () {
        var $ = layui.$, layer = layui.layer, element = layui.element, form = layui.form;

        form.on('select(received)', function (data) {
            //获得下拉框选中的id
            var type = data.value;
            if (type == 1) {
                $("#expMsg").show();
            } else {
                $("#expMsg").hide();
            }
        });
        
        form.on('select(expCode)', function (data) {
        	var name = $("#expCode option:selected").text()
        	$("input[name='expName']").val(name);
        })
    });

</script>
</body>
</html>